<html>
<head><meta charset="utf-8"><title>ui error annoations for multi-span errors? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html">ui error annoations for multi-span errors?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="192404825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192404825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192404825">(Mar 31 2020 at 15:25)</a>:</h4>
<p>I am trying to make compiletest accept the following output:</p>
<div class="codehilite"><pre><span></span>error: any use of this value will cause an error
  --&gt; $DIR/dangling.rs:8:16
   |
LL | / const TEST: () = { unsafe {
LL | |     let slice: *const [u8] = mem::transmute((1usize, usize::MAX));
LL | |     let _val = &amp;*slice;
   | |                ^^^^^^^
   | |                |
   | |                invalid metadata in wide pointer: slice is bigger than largest supported object
   | |                inside `TEST` at $DIR/dangling.rs:8:16
LL | |
LL | |
LL | |
LL | | } };
   | |____-
   |
   = note: `#[deny(const_err)]` on by default

error: aborting due to previous error
</pre></div>


<p>but I cannot figure out how I have to set the annotations. I think this should work but it puts everything on the wrong line:</p>
<div class="codehilite"><pre><span></span>use std::{mem, usize};

// Make sure we error with the right kind of error on a too large slice.
const TEST: () = { unsafe { //~ NOTE
    let slice: *const [u8] = mem::transmute((1usize, usize::MAX));
    let _val = &amp;*slice; //~ ERROR: any use of this value will cause an error
    //~^^ NOTE: slice is bigger than largest supported object
    //~^^ inside `TEST`
    //~^^ on by default
} };

fn main() {}
</pre></div>



<a name="192404897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192404897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192404897">(Mar 31 2020 at 15:25)</a>:</h4>
<p>is there documentation somewhere for what the right number of magic sigils is that needs to be put where?^^</p>



<a name="192405078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192405078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192405078">(Mar 31 2020 at 15:26)</a>:</h4>
<p>ah, this worked:</p>
<div class="codehilite"><pre><span></span>use std::{mem, usize};

// Make sure we error with the right kind of error on a too large slice.
const TEST: () = { unsafe { //~ NOTE
    let slice: *const [u8] = mem::transmute((1usize, usize::MAX));
    let _val = &amp;*slice; //~ ERROR: any use of this value will cause an error
    //~^ NOTE: slice is bigger than largest supported object
    //~^^ NOTE: inside `TEST`
    //~^^^ on by default
} };

fn main() {}
</pre></div>


<p>I have no idea why though</p>



<a name="192405115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192405115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192405115">(Mar 31 2020 at 15:27)</a>:</h4>
<p>I dont think I had to put increasing number of <code>^</code> before...</p>



<a name="192405582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192405582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192405582">(Mar 31 2020 at 15:30)</a>:</h4>
<p>each <code>^</code> is how many lines up the error should appear</p>



<a name="192405770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192405770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192405770">(Mar 31 2020 at 15:31)</a>:</h4>
<p>You can use <code>//~|</code> to mean "same line as the above pattern" so you don't have to use so many <code>^</code>s</p>



<a name="192406019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192406019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192406019">(Mar 31 2020 at 15:33)</a>:</h4>
<p>and the sigils' documentation is <a href="https://rustc-dev-guide.rust-lang.org/tests/adding.html#error-annotations" title="https://rustc-dev-guide.rust-lang.org/tests/adding.html#error-annotations">here</a></p>



<a name="192410715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192410715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192410715">(Mar 31 2020 at 16:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F/near/192405770" title="#narrow/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F/near/192405770">said</a>:</p>
<blockquote>
<p>You can use <code>//~|</code> to mean "same line as the above pattern" so you don't have to use so many <code>^</code>s</p>
</blockquote>
<p>ah, <code>|</code> must be what I used otherwise</p>



<a name="192410799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192410799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192410799">(Mar 31 2020 at 16:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F/near/192406019" title="#narrow/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F/near/192406019">said</a>:</p>
<blockquote>
<p>and the sigils' documentation is <a href="https://rustc-dev-guide.rust-lang.org/tests/adding.html#error-annotations" title="https://rustc-dev-guide.rust-lang.org/tests/adding.html#error-annotations">here</a></p>
</blockquote>
<p>thanks! I was looking for a README file like we have it e.g. for codegen tests. looks like rustc-dev-guide is the btter location these days :)</p>



<a name="192422862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/ui%20error%20annoations%20for%20multi-span%20errors%3F/near/192422862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/ui.20error.20annoations.20for.20multi-span.20errors.3F.html#192422862">(Mar 31 2020 at 17:32)</a>:</h4>
<p>TODO:</p>
<div class="codehilite"><pre><span></span>% cat README.md

Go [read the rustc-dev-guide](appropriate link)
</pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>